//自定义模板组件
Vue.component('mydiv', {
    template: `
        <div>
            <ul>
                 <li @click="nam(name)" v-for="name in arr"><a href="" >{{name}}</a></li>
            </ul>
        </div>
    `,
    data:function () {//模板组件不能访问vue对象中的变量和方法
        return{ arr: ["刘备", "关羽", "张飞"]}
    },
    methods: {
        nam: function (name) {
            alert(name)
        }
    }
})
let v = new Vue({
    el: "mydiv"
})